package cn.com.czpb.client.module.subscribe.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import cn.com.czpb.client.R;
import cn.com.czpb.client.model.subscribe.SubscribeListSecondBean;

import java.util.List;

/**
 * Created by 猪猪侠 on 2017/7/31.
 */

public class SubscribeMoreListAdapter extends BaseQuickAdapter<SubscribeListSecondBean,BaseViewHolder> {
    private List<SubscribeListSecondBean> list;
    public SubscribeMoreListAdapter( @Nullable List<SubscribeListSecondBean> data) {
        super(R.layout.item_subscribemore_list);
        this.list = data;

    }

    @Override
    protected void convert(BaseViewHolder helper, SubscribeListSecondBean item) {
        helper.setText(R.id.tv_title_id,item.getNickname())
                .setText(R.id.tv_subscribe_num_id,item.getFans()+"人已订阅")
        .addOnClickListener(R.id.img_subscribe_id)
        .addOnClickListener(R.id.ll_root_id)
        .addOnClickListener(R.id.img_remove_subscribe_id);
        Glide.with(mContext).load(item.getAvatarPath()).placeholder(R.drawable.default_bg).crossFade().into((ImageView) helper.getView(R.id.img_icon_id));
        if ("1".equals(item.getIsfocus())){
            helper.setVisible(R.id.img_remove_subscribe_id,true);
            helper.setVisible(R.id.img_subscribe_id,false);
        }else{
            helper.setVisible(R.id.img_subscribe_id,true);
            helper.setVisible(R.id.img_remove_subscribe_id,false);
        }

    }
}
